
<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="zh_cn">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
      <title>6.2.&nbsp;&#22312;&#33756;&#21333;&#26639;&#19978;&#28155;&#21152;&#33756;&#21333;&#39033; [&#28145;&#20837;&#27973;&#20986; Greasemonkey]</title>
      <link rel="shortcut icon" href="/favicon.ico">
      <link rel="stylesheet" href="../css/dig.css" type="text/css">
      <meta http-equiv="Link" content='&lt;../css/modern.css&gt;; type="text/css"; rel=stylesheet, &lt;../css/empty.css&gt;; type="text/css";
      rel=stylesheet'>
      <link rev="made" href="mailto:mark@diveintomark.org">
      <meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
      <meta name="keywords" content="Firefox, Greasemonkey, Javascript, user script, userscript">
      <link rel="start" href="../toc/index.html" title="&#28145;&#20837;&#27973;&#20986; Greasemonkey">
      <link rel="up" href="index.html" title="&#31532;&nbsp;6&nbsp;&#31456;&nbsp;&#39640;&#32423;&#35805;&#39064;">
      <link rel="prev" href="gm_getvalue.html" title="6.1.&nbsp;&#23384;&#21462;&#25345;&#20037;&#25968;&#25454;">
      <link rel="next" href="gm_xmlhttprequest.html" title="6.3.&nbsp;&#25972;&#21512;&#20854;&#20182;&#32593;&#31449;&#30340;&#25968;&#25454;">
   </head>
   <body id="diveintogreasemonkey-org" class="advanced-registermenucommand">
      <div class="z" id="intro">
         <div class="sectionInner">
            <div class="sectionInner2">
               <div class="s">
                  <h1><a href="/" accesskey="1">&#28145;&#20837;&#27973;&#20986; Greasemonkey</a></h1>
                  <p>&#25945;&#32769;&#32593;&#32476;&#23398;&#26032;&#25226;&#25103;</p>
               </div>
               <div class="s">
                  <ul>
                     <li><a href="../">&#36215;&#22987;&#39029;</a> &middot; 
                     </li>
                     <li><a href="../toc/">&#30446;&#24405;</a> &middot; 
                     </li>
                     <li><a href="../download/">&#19979;&#36733;</a> &middot; 
                     </li>
                     <li><a href="http://greasemonkey.mozdev.org/">&#31435;&#21363;&#19979;&#36733; Greasemonkey</a></li>
                  </ul>
               </div>
            </div>
         </div>
      </div>
      <div id="main">
         <div id="mainInner">
            <p id="breadcrumb">&#24744;&#30340;&#20301;&#32622;&#65306;<a href="../">&#36215;&#22987;&#39029;</a> &#8594; <a href="../toc/index.html">&#30446;&#24405;</a> &#8594; <a href="index.html">&#39640;&#32423;&#35805;&#39064;</a> &#8594; <span class="thispage">&#22312;&#33756;&#21333;&#26639;&#19978;&#28155;&#21152;&#33756;&#21333;&#39033;</span></p>
            <div class="section" lang="zh_cn">
               <div class="titlepage">
                  <div>
                     <div>
                        <h2 class="title"><a name="advanced.registermenucommand" class="skip" href="#advanced.registermenucommand" title="link to this section"><img src="../images/permalink.gif" alt="[link]" title="link to this section" width="8" height="9"></a> 6.2.&nbsp;&#22312;&#33756;&#21333;&#26639;&#19978;&#28155;&#21152;&#33756;&#21333;&#39033;
                        </h2>
                     </div>
                     <div>
                        <div class="abstract">
                           <h3 class="title"></h3>
                           <p>Greasemonkey &#23450;&#20041;&#20102;&#19968;&#20010;&#20989;&#25968;&#65292;<code class="function">GM_registerMenuCommand</code>&#65292;&#35753;&#29992;&#25143;&#33050;&#26412;&#21487;&#28155;&#21152;&#33756;&#21333;&#39033;&#21040; Firefox &#33756;&#21333;&#26639;&#19978;&#12290;&#24403;&#29992;&#25143;&#33050;&#26412;&#28608;&#27963;&#26102;&#65292;&#27880;&#20876;&#30340;&#33756;&#21333;&#39033;&#20250;&#20986;&#29616;&#22312;<span><strong class="guimenuitem">User Script <span class="accel">C</span>ommands</strong></span> &#23376;&#33756;&#21333;&#20013;&#12290;
                           </p>
                        </div>
                     </div>
                  </div>
               </div>
               <div class="informalexample"><pre class="programlisting ">function GM_registerMenuCommand(menuText, callbackFunction);</pre></div>
               <p>
                  <em class="parameter"><code>menuText</code></em> &#21442;&#25968;&#26159;&#19968;&#20010;&#23383;&#31526;&#20018;&#65292;&#26032;&#22686;&#30340;&#33756;&#21333;&#39033;&#30340;&#21517;&#31216;&#12290;<em class="parameter"><code>callbackFunction</code></em> &#21442;&#25968;&#26159;&#20989;&#25968;&#23545;&#35937;&#12290;&#36873;&#20013;&#27492;&#33756;&#21333;&#39033;&#65292;<code class="function">callbackFunction</code> &#20989;&#25968;&#23601;&#20250;&#34987;&#35843;&#29992;&#12290;
               </p>
               <p>&#36825;&#20010;&#20989;&#25968;&#30001; Greasemonkey 0.2.6 &#24341;&#20837;&#12290;&#24744;&#24212;&#35813;<a href="../patterns/function-exists.html" title="4.2.&nbsp;&#27979;&#35797; Greasemonkey &#20989;&#25968;&#26159;&#21542;&#26377;&#25928;">&#27979;&#35797;&#23427;&#26159;&#21542;&#23384;&#22312;</a>&#65292;&#21542;&#21017;&#23436;&#20840;&#38477;&#20302;(degrade gracefully)&#12290;
               </p>
               <div class="furtherreading"><a href="../appendix/furtherreading.html" title="&#xA;&#8220;&#21442;&#32771;&#36164;&#26009;&#8221;&#38142;&#25509;&#28165;&#21333;">
                     <h3>&#21442;&#32771;&#36164;&#26009;</h3></a><ul>
                     <li>
                        <a href="http://kailasa.net/prakash/greasemonkey/post-interceptor.user.js">POST Interceptor</a> &#26032;&#22686;&#20102;&#33756;&#21333;&#39033;&#26469;&#20999;&#25442;&#33050;&#26412;&#26159;&#21542;&#26377;&#25928;&#12290;
                     </li>
                  </ul>
               </div>
               <div class="seealso">
                  <h3>&#21442;&#35265;</h3>
                  <ul>
                     <li>
                        <a href="../api/gm_registermenucommand.html" title="GM_registerMenuCommand"><span class="refentrytitle">GM_registerMenuCommand</span></a>
                        
                     </li>
                  </ul>
               </div>
            </div>
            <div style="float: left">&#8592;&nbsp;<a class="NavigationArrow" href="gm_getvalue.html">&#23384;&#21462;&#25345;&#20037;&#25968;&#25454;</a></div>
            <div style="text-align: right"><a class="NavigationArrow" href="gm_xmlhttprequest.html">&#25972;&#21512;&#20854;&#20182;&#32593;&#31449;&#30340;&#25968;&#25454;</a>&nbsp;&#8594;
            </div>
            <hr style="clear:both">
            <div class="footer">
               <p class="copyright">&#29256;&#26435; &copy; 2005 Mark Pilgrim &middot; <a title="&#21457;&#36865;&#32473;&#25105;&#26377;&#20110;&#27492;&#20070;&#30340;&#21453;&#39304;&#24847;&#35265;" href="mailto:mark@diveintomark.org">mark@diveintomark.org</a> &middot; <a href="../license/gpl.html" title="GNU &#36890;&#29992;&#20844;&#20849;&#35768;&#21487;&#35777;">&#20351;&#29992;&#26465;&#27454;</a></p>
            </div>
         </div>
      </div>
   </body>
</html>